package org.osprey.apidoc.pojo;

import io.vertx.codegen.annotations.DataObject;
import io.vertx.core.json.JsonObject;
import lombok.Data;
import org.osprey.apidoc.converter.UserConverter;

import java.io.Serializable;

/**
 * @ClassName User
 * @Description: 用户POJO
 * @Author Osprey
 * @Date 2019/10/15
 * @Version V2.0
 **/
@Data
@DataObject(generateConverter = true)
public class User implements Serializable {
    /**
     * 用户id
     */
    private Integer userID;
    /**
     * 用户名
     */
    private String userName;
    /**
     * 用户密码
     */
    private String userPassword;
    /**
     * 用户昵称
     */
    private String userNickName;

    public User() {
    }

    public User (JsonObject jsonObject) {

        UserConverter.fromJson(jsonObject, this);
    }

    public JsonObject toJson() {
        JsonObject json = new JsonObject();
        UserConverter.toJason(this, json);
        return json;
    }

    @Override
    public String toString() {
        return "User{" +
                "userID=" + userID +
                ", userName='" + userName + '\'' +
                ", userPassword='" + userPassword + '\'' +
                ", userNickName='" + userNickName + '\'' +
                '}';
    }
}
